package com.example.demo.controller;

import com.example.demo.po.QuestionPo;
import com.example.demo.service.QuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api("问卷相关接口")
@RestController
@RequestMapping("/yuansheng/question")
public class QuestionController {
    @Autowired
    private QuestionService service;

    @ApiOperation("所有问卷列表")
    @GetMapping("/list")
    public List<QuestionPo> list(){
        return service.list();
    }

    @ApiOperation("保存一次问卷调查")
    @RequestMapping("/save")
    public String save(QuestionPo questionPo){
        service.save(questionPo);
        return "success";
    }
}
